-- file: ch06/Overlap.hs
{-# LANGUAGE TypeSynonymInstances #-}

class Borked a where
  bork :: a -> String

instance Borked Int where
  bork = show

instance {-# OVERLAPPABLE #-} (Borked a, Borked b) => Borked (a, b) where
  bork (a, b) = ">>" ++ bork a ++ " " ++ bork b ++ "<<"

instance Borked (Int, Int) where
  bork (a, b) = bork a ++ ", " ++ bork b
